import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader;

class Singleton{ // 饿汉
    private static Singleton instance = new Singleton();
    private Singleton(){}
    public static Singleton getInstance(){
        return instance;
    }
}
class Singleton2{
    private static Singleton2 instance = null;    // 注意这里最好再加一个volatile关键字
    private Singleton2(){}
    public static Singleton2 getInstance(){
        if(instance == null){
            synchronized (instance){
                if(instance==null){
                    instance = new Singleton2();
                }
            }
        }
        return instance;
    }
}

public class SingleObject {

    public static void mai1n(String[] args) {

    }


}
